<#assign className = table.className>
<#assign classNameLower = className?uncap_first>
<#assign classNameCap = className?lower_case?cap_first>
package ${basepackage}.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import ${basepackage}.entity.${className};
import ${basepackage}.service.${className}Service;
import ${basepackage}.framework.model.PageData;
import ${basepackage}.framework.model.PageParam;
import $
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;


@Tag(name="${className}接口：${table.remarks}")
@RestController
@RequestMapping(value="/${className}")
@Slf4j
public class ${className}Controller  {
	
	private final String info_prefix = "[${table.remarks}模块]";

	@Autowired
	private ${className}Service ${classNameLower}Service;


	@Operation(summary="${table.remarks}分页列表")
	@PostMapping(value = "list")
	public R list(@RequestBody PageParam<${className}> param){
		log.debug("{}-列表数据", info_prefix);
		PageData<${className}> data =  ${classNameLower}Service.page(param);
		return R.ok().data(data);
	}


	@Operation(summary="${table.remarks}详情")
	@GetMapping("/view/{id}")
	public R view(@PathVariable Integer id){
		log.debug("{}-查看${table.remarks}信息", info_prefix);
		${className} data = ${classNameLower}Service.getById(id);
		return R.ok().data(data);
	}
	

	@Operation(summary="新增${table.remarks}")
	@PostMapping("add")
	public R add(@RequestBody ${className}  record) {
		log.debug("{}-新增${className}: {}", info_prefix,  record);
		${classNameLower}Service.insert(record);
		return R.ok("新增成功").data(record);
	}

	
	@Operation(summary="根据ID删除${table.remarks}")
	@PostMapping("/del/{id}")
	public R del(@PathVariable Integer id){
		log.debug("{}-根据ID删除", info_prefix, id);
		${classNameLower}Service.delete(id);
		return R.ok("删除成功");
	}

	
	@Operation(summary="更新${table.remarks}")
	@PostMapping("update")
	public R update(@RequestBody ${className}  record){
		log.debug("{}-保存信息: {}", info_prefix, record);
		${classNameLower}Service.update(record);
		return R.ok("更新成功");
	}
	
	@Operation(summary="查看${table.remarks}属性")
	@GetMapping("/model")
	public ${className} model() {
		return null;
	}
	
}
